package cloud.daodao.storm.common.security.model.secret;

import cloud.daodao.storm.common.constant.AppConstant;
import cloud.daodao.storm.common.serialize.Serializer;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @author DaoDao
 */
@Schema(title = "AesData", description = "AES 数据")
@Data
public class AesData implements Serializer {

    @Schema(title = "id", description = "id", example = "1")
    @NotEmpty
    @Size(min = 18, max = 18)
    @Pattern(regexp = "^\\d+$")
    private String id;

    @Schema(title = "aesKey", description = "AES 密钥", example = "0000000000000000")
    @NotEmpty
    @Size(min = 16, max = 16)
    @Pattern(regexp = "^[0-9a-fA-F]{16}$")
    private String aesKey;

    @Schema(title = "aesIv", description = "AES 向量", example = "0000000000000000")
    @NotEmpty
    @Size(min = 16, max = 16)
    @Pattern(regexp = "^[0-9a-fA-F]{16}$")
    private String aesIv;

    @Schema(title = "createTime", description = "创建时间", example = AppConstant.DATE_TIME_EXAMPLE)
    @NotNull
    private LocalDateTime createTime;

    @Schema(title = "updateTime", description = "更新时间", example = AppConstant.DATE_TIME_EXAMPLE)
    @NotNull
    private LocalDateTime updateTime;

    @Schema(title = "valid", description = "有效性", example = "true")
    @NotNull
    private Boolean valid;

}
